//
//  TestPhoneModelView.swift
//  E-CycleForShop
//
//  Created by enghou on 17/3/6.
//  Copyright © 2017年 xyxorigation. All rights reserved.
//

import UIKit

class TestPhoneModelView: BaseView {
    var title : String = "" {
        didSet{
            label.text = title
            let size = label.text!.StringSize(font: label.font)
            label.frame = CGRect.init(origin: label.frame.origin, size: size)
        }
    }
    
    var priceRange : String = "" {
        didSet{
            rangeLbl.text = priceRange + "元"
            let size = rangeLbl.text!.StringSize(font: rangeLbl.font)
            rangeLbl.frame = CGRect.init(origin: rangeLbl.frame.origin, size: size)
        }
    }
    private let label = UILabel.init()
    private let rangeLbl = UILabel.init()
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.colorWithHexString(hex: "f9f9f9")
        let titleImg = UIImageView.init()
        titleImg.frame = CGRect.init(x: 28 * YXWidthScale, y: 18 * YXHeightScale, width: 160 * YXWidthScale, height: 160 * YXHeightScale)
        titleImg.image = UIImage.load(name: "pic_iphone")
        self.addSubview(titleImg)
        titleImg.layer.cornerRadius = YXCornerRadius
        titleImg.layer.masksToBounds = true
        titleImg.layer.borderColor = UIColor.colorWithHexString(hex: "fbfbfb").cgColor
        titleImg.layer.borderWidth = YXWidthScale
        label.font = UIFont.boldSystemFont(ofSize: 30 * YXWidthScale)
        label.textColor = UIColor.black
        label.textAlignment = .center
        let size1 = "呵呵".StringSize(font: label.font)
        label.frame = CGRect.init(origin: CGPoint.init(x: titleImg.right() + 28 * YXWidthScale, y: 52 * YXHeightScale), size: size1)
        self.addSubview(label)
        
        let estimate = UILabel.init()
        estimate.textColor = UIColor.colorWithHexString(hex: "909090")
        estimate.font = UIFont.systemFont(ofSize: 28 * YXWidthScale)
        let size = "评估价格:".StringSize(font: estimate.font)
        estimate.frame = CGRect.init(origin: CGPoint.init(x: label.left(), y: label.bottom() + 30 * YXHeightScale), size: size)
        estimate.text = "评估价格:"
        self.addSubview(estimate)
        
        rangeLbl.frame = CGRect.init(origin: CGPoint.init(x: estimate.right(), y: estimate.top()), size: CGSize.zero)
        rangeLbl.textColor = UIColor.colorWithHexString(hex: "30c27c")
        rangeLbl.font = UIFont.boldSystemFont(ofSize: 28 * YXWidthScale)
        self.addSubview(rangeLbl)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
